package LECONGHAU.STRUCTURE_PROGRAMMING.EXCERCISES;

import java.util.Scanner;

public class bai4 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String thang, nam;
		do {
			System.out.println("nhap vao thang can tinh so ngay");
			Scanner sc = new Scanner(System.in);
			thang = sc.nextLine();
			System.out.println("nhap vao nam");
			nam = sc.nextLine();
			if (thang.isEmpty() || Integer.parseInt(thang) < 1
					|| Integer.parseInt(thang) > 12) {
				System.out.println("vui long nhap lai");
			}
		} while (thang.isEmpty() || Integer.parseInt(thang) < 1
				|| Integer.parseInt(thang) > 12);
		int intthang = Integer.parseInt(thang);
		int intnam = Integer.parseInt(nam);
		if (intthang == 4 || intthang == 6 || intthang == 9 || intthang == 11) {
			System.out.println("thang" + intthang + "nam" + intnam
					+ "co 30 ngay");
		} else if (intthang == 2) {
			if (intnam % 4 == 0 && intnam % 400 == 0 && intnam % 100 != 0) {
				System.out.println("thang 2 nam" + intnam + "co 29 ngay");
			} else {
				System.out.println("thang 2 nam" + intnam + "co 28 ngay");
			}
		} else {
			System.out.println("thang" + intthang + "nam" + intnam
					+ "co 31 ngay");
		}
	}

}
